﻿function shopbox(){
         $("#car").css("background","#fff");
         $("#car").css("color","rgb(255,103,0)");
         $("#shopbox").slideDown("slow");
         event.stopPropagation();
     }
    function colsebox(){
	     $("#car").css("background","rgb(66,66,66)");
         $("#car").css("color","#b0b0b0");
         $("#shopbox").slideUp("slow");
     }
    function showhotbox(){
		$("#hotbox").fadeIn("slow");
        event.stopPropagation();
        var borders = document.getElementsByName("sborder");
        for(var i=0;i<borders.length;i++){
            borders[i].style.borderColor = "rgb(255,103,0)";
        }
		$("#tag").css("display","none");
     }
    function hidehotbox(){
        $("#hotbox").fadeOut("slow");
        var borders = document.getElementsByName("sborder");
        for(var i=0;i<borders.length;i++){
             borders[i].style.borderColor = "rgb(224,224,224)";
        }
        $("#tag").css("display","block");
     }
    var temp=null;
    function showtag(obj){
	temp = obj;
        for(var i=0;i<10;i++){
            $("#left ul li:eq("+i+")").css("background","rgba(0,0,0,0)");
            if(i != temp){	
              $("#"+i+"").css("display","none");
            }
        }
	$("#left ul li:eq("+temp+")").css("background","rgb(255,103,0)");
        $("#"+temp+"").fadeIn();
        event.stopPropagation();
     }
    function colsetag(){
	$("#"+temp+"").fadeOut();	
        $("#left ul li:eq("+temp+")").css("background","rgba(0,0,0,0)");		 
     }
    
    var index = 0;  
    var nLeft = 0;
    function lastpic(){
       pi = document.getElementById("pi").getElementsByTagName("li");
       index = index-1;
       if(index < 0){
          index = 4;
         }
       nLeft = -index*1218;
        for (var i = 0; i < pi.length; ++i) {
           pi[i].style.background = "rgb(102,102,102)";
        } 
        $("#ppt").css("left",nLeft);
        $("#ppt").hide(10)
        $("#ppt").fadeIn(500);
         pi[index].style.background = "#fff";
     }
    
     function nextpic(){
       pi=document.getElementById("pi").getElementsByTagName("li");
       index=index+1;
       if(index>4){
           index=0;
         }
      nLeft  = -index*1218;
      for (var i = 0; i < pi.length; ++i) {
          pi[i].style.background = "rgb(102,102,102)";
       } 
      $("#ppt").css("left",nLeft);
      $("#ppt").hide(10);
      $("#ppt").fadeIn(500);
      pi[index].style.background = "#fff";
     }
     
     function getpic(obj){
       pi = document.getElementById("pi").getElementsByTagName("li");
       nLeft  = -obj*1218;
      for (var i = 0; i < pi.length; ++i) {
          pi[i].style.background = "rgb(102,102,102)";
       } 
      $("#ppt").css("left",nLeft);
      $("#ppt").hide(10);
      $("#ppt").fadeIn(500);
      pi[obj].style.background = "#fff";
      }
      
      var timer = null;
      var nowLeft = 0;
      function play(){
       timer = setInterval(autoPlay,5000);
      }
      
      function autoPlay() {
        if (nowLeft==0){
            nowLeft= -1*1218;
            $("#next").css("color","rgb(224,224,224)");
            $("#last").css("color","rgb(225,103,0)");
         }else{
            nowLeft= 0;
            $("#last").css("color","rgb(224,224,224)");
            $("#next").css("color","rgb(225,103,0)");
         }
        $("#new-pic").animate({"left":nowLeft},1000);
      }
     
      function stopPlay(){
         clearInterval(timer);
      }

      function gonoPlay(){
         timer = setInterval(autoPlay,5000);
      }

      function lasttag(obj){
          nowLeft = 0*1218; 
	      $("#new-pic").animate({"left":nowLeft},1000);
          $("#last").css("color","rgb(224,224,224)");
          $("#next").css("color","rgb(225,103,0)");
      }

      function nexttag(obj){
          nowLeft = -1*1218; 
	  $("#new-pic").animate({"left":nowLeft},1000);
          $("#next").css("color","rgb(224,224,224)");
          $("#last").css("color","rgb(225,103,0)");    
      }
	  
	  function changeColor(){
		  $(".graybox1-right").css("color","rgb(225,103,0)");
		  $(".graybox1-right0").css("background","rgb(225,103,0)");
		  $(".graybox1-right").css("cursor","pointer");
		  $(".graybox1-right0").css("cursor","pointer");
		  $(".graybox1-right").css("transition","0.5s");
		  $(".graybox1-right0").css("transition","0.5s");
	  }
	  
	  function backColor(){
		  $(".graybox1-right").css("color","");
		  $(".graybox1-right0").css("background","rgb(176,176,176)");
	  }
	  
	  var last = "S";
	  function getBox(index){
		  if(last != "S"){
		     $("#"+last).css("color","");
		     $("#"+last).css("border","0");
		  }
		  if(index !="A"|| index !="E"){
			 $("#A").css("color","");
		     $("#A").css("border","0");
		     $("#E").css("color","");
		     $("#E").css("border","0");
		  }
		  var num = 0;
		  $("#"+index).css("color","rgb(250,103,0)");
		  $("#"+index).css("border-bottom","2px solid rgb(250,103,0)");
		  if(index == "A"||index == "E"){
			  num = 0;
		  }else if(index == "B"||index == "F"){
			  num = 1;
		  }else if(index == "C"||index == "G"){
			  num = 2;
		  }else{
			  num = 3;
		  }
		  var Left = -num*992;	 
		  if(index == "A" || index == "B" || index == "C" || index == "D"){
		  	$("#graybox2-png").css("left",Left);
		  }else{
		  	$("#pj").css("left",Left);
		  }
		  last = index;
	  }
	  
	  function showTalks(){
		$("#talk1").animate({"top":-50},800);
		event.stopPropagation();
	  }
	  function hideTalks(){
		$("#talk1").animate({"top":25},800);
		event.stopPropagation();
	  }
	  
	  function getShops(){
		var div = document.getElementById("shops");
        var tempStr = '<div class="graybox1-box" >';
			tempStr += '<div class="graybox1-box-png"><img src="img/graybox1.2.jpg" width="160px" height="160px"></div>';
			tempStr += '<div class="graybox1-box-title">米家IH电饭煲</div>';
			tempStr += '<div class="graybox1-box-text">IH电磁环绕加热，3000+煮饭方案<p style="color:rgb(250,103,0);font-size:14px">339元</p></div> </div>';		
		div.innerHTML = tempStr;
	  }
	  
	  var tLeft = 0;
	  var currnt = 0;
	  function getNextTJ(){	
	  	  currnt++;
	  	  if(currnt>=3){
	  	  	currnt = 3;
	  	  	$("#nextTJ").css("color","rgb(224,224,224)");
	  	  }
          tLeft = -currnt*1218; 
	      $("#tj").animate({"left":tLeft},1000);
          $("#lastTJ").css("color","rgb(225,103,0)");    
      }
	  
	    function getLastTJ(){	
	      currnt--;
	      if(currnt<=0){
	      	currnt = 0;
	      	$("#lastTJ").css("color","rgb(224,224,224)");
	      }
          tLeft = - currnt*1218; 
	      $("#tj").animate({"left":tLeft},1000);
          $("#nextTJ").css("color","rgb(225,103,0)");    
      }
	  
	  